#!/usr/bin/env groovy

// Load utils.
@UTILS_CONTENT@

node(getNodeLabel()) {
  stage('test') {
    timeout(600) {
      ansiColor('xterm') {
        timestamps {
          try {
            cleanWorkspace()
            dir(env.WORKSPACE) {
              // Always use drake-ci/main for staging builds, but use the
              // drake SHA parameter for the drake checkout.
              def scmVars = checkout('main', params.sha1)
              doMainBuild(scmVars, params.release_version)
            }
          } finally {
            try {
              checkBuildResult()
              addCDashBadge()
            } finally {
              cleanWorkspace()
            }
          }
        }
      }
    }
  }
}
